{% if procmemory %}
    <div class="tabbable tabs">
        <ul class="nav nav-tabs" style="margin-bottom: 0;">
            {% for proc in procmemory %}
                <li {%if forloop.first %}class="nav-item active"{% endif %}><a class="nav-link" href="#procmemory_{{proc.pid}}" data-toggle="tab">{{proc.pid}}</a></li>
            {% endfor %}
        </ul>
        <div class="tab-content">
            {% for proc in procmemory %}
                {% if forloop.first %}
                <div class="tab-pane fade show active" id="procmemory_{{proc.pid}}">
                {% else %}
                <div class="tab-pane fade" id="procmemory_{{proc.pid}}">
                {% endif %}
                    <center><h4>Full Dump Information</h4></center>
                    <table class="table table-striped table-bordered table-dark table-sm table-hover" style="table-layout: fixed; width: 50%;margin-left: auto;margin-right: auto;">
                        <tr>
                            <th width="15%">Process Name</th>
                            <td>{{proc.name}}</td>
                        </tr>
                        <tr>
                            <th>Executable Path</th>
                            <td>{{proc.proc_path}}</td>
                        </tr>
                        {% if proc.yara %}
                        <tr>
                            <th>Yara</th>
                            <td>
                                {% for match in proc.yara %}
                                    <li>Match: {{match.name}} - {{match.meta.description}}
                                    {% if match.meta.author %}
                                        - Author: {{match.meta.author}}
                                    {% endif %}
                                    </li>
                                {% endfor %}
                            </td>
                        </tr>
                        {% endif %}
                        {% if proc.cape_yara %}
                        <tr>
                            <th>CAPE Yara</th>
                            <td>
                            {% for match in proc.cape_yara %}
                                <li>
                                Match: {{match.name}}
                                {% if match.meta.cape_type %} - {{match.meta.cape_type}}
                                {% elif match.meta.description %} - {{match.meta.description}}
                                {% endif %}
                                {% if match.meta.author %} - Author: {{match.meta.author}}{% endif %}
                                </li>
                            {% endfor %}
                            </td>
                        </tr>
                        {% endif %}
                        {% if proc.path %}
                            <tr>
                                <th>Full Dump</th>
                                <td>
                                    <a class="btn btn-secondary btn-small" href="{% url "file" "memdump" id proc.pid %}" data-bs-toggle="tooltip" title="Download file"><span class="fas fa-download"></a>
                                    <a class="btn btn-secondary btn-small" href="{% url "file" "memdumpzip" id proc.pid %}" data-bs-toggle="tooltip" title="Download password-protected archive"><span class="fas fa-file-archive"></span> <span class="fas fa-download"></span></a>
                                </td>
                            </tr>
                        {% endif %}
                        {% if proc.strings_path %}
                            <tr>
                                <th>Process Strings</th>
                                <td><a class="btn btn-secondary btn-small" href="{% url "file" "memdumpstrings" id proc.pid %}" data-bs-toggle="tooltip" title="Download strings"><span class="fas fa-download"></a></td>
                            </tr>
                        {% endif %}
                    </table>
                    {% if proc.address_space %}
                    <center><h4>Address Space</h4></center>
                    <table class="table table-striped table-bordered table-dark table-sm table-hover" style="table-layout: fixed; width: 50%; text-align: center;margin-left: auto;margin-right: auto;">
                            <tr>
                                <th width="15%">Start</th>
                                <th width="15%">End</th>
                                <th width="15%">Size</th>
                                <th width="10%">Protection</th>
                                <th width="10%">PE</th>
                                <th width="15%">Download</th>
                            </tr>
                            {% for memmap in proc.address_space %}
                                <tr>
                                    {% if memmap.chunks|length >= 2 %}
                                    <td><a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href=".map_{{memmap.start}}">{{memmap.start}}</a></td>
                                    {% else %}
                                    <td>{{memmap.start}}</td>
                                    {% endif %}
                                    <td>{{memmap.end}}</td>
                                    <td>{{memmap.size}}</td>
                                    <td>{{memmap.prot}}</td>
                                    {% if memmap.PE %}
                                    <td><span class="badge badge-success">Yes</span></td>
                                    {% else %}
                                    <td><span class="badge badge-primary">No</span></td>
                                    {% endif %}
                                    {% if proc.path %}
                                    <td>
                                        <a class="btn btn-secondary btn-small" href="{% url "procdump" id proc.pid memmap.start memmap.end %}" data-bs-toggle="tooltip" title="Download file"><span class="fas fa-download"></a>
                                        <a class="btn btn-secondary btn-small" href="{% url "procdump" id proc.pid  memmap.start memmap.end 1 %}" data-bs-toggle="tooltip" title="Download password-protected archive"><span class="fas fa-file-archive"></span> <span class="fas fa-download"></span></a>
                                    </td>

                                    {% endif %}
                                </tr>
                                {% if memmap.chunks|length >= 2 %}
                                {% for chunk in memmap.chunks %}
                                    <tr class="collapse map_{{memmap.start}}">
                                        <td>{{chunk.start}}</td>
                                        <td>{{chunk.end}}</td>
                                        <td>{{chunk.size}}</td>
                                        <td>{{chunk.prot}}</td>
                                        <td></td>
                                        {% if proc.path %}
                                        <td>
                                            <a class="btn btn-secondary btn-small" href="{% url "procdump" id proc.pid chunk.start chunk.end %}" data-bs-toggle="tooltip" title="Download file"><span class="fas fa-download"></a>
                                            <a class="btn btn-secondary btn-small" href="{% url "procdump" id proc.pid chunk.start chunk.end 1 %}" data-bs-toggle="tooltip" title="Download password-protected archive"><span class="fas fa-file-archive"></span> <span class="fas fa-download"></span></a>
                                        </td>
                                        {% endif %}
                                    </tr>
                                {% endfor %}
                                {% endif %}
                            {% endfor %}
                    </table>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    </div>
{% else %}
    <div class="alert alert-secondary"><b>Sorry!</b> No process dumps.</div>
{% endif %}
